local joy__jiezhong = fk.CreateSkill {

  name = "joy__jiezhong",

  tags = { Skill.Limited, },

}



joy__jiezhong:addEffect(fk.EventPhaseStart, {
  name = "joy__jiezhong",
  anim_type = "drawcard",
  frequency = Skill.Limited,
  events = {fk.EventPhaseStart},
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(joy__jiezhong.name) and player.phase == Player.Play and
      player.maxHp > player:getHandcardNum() and player:usedSkillTimes(joy__jiezhong.name, Player.HistoryGame) == 0
  end,
  on_cost = function(self, event, target, player, data)
    local draw = player.maxHp - player:getHandcardNum()
    return player.room:askForSkillInvoke(player, joy__jiezhong.name, nil, "#joy__jiezhong-invoke:::"..draw)
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local n = player.maxHp - player:getHandcardNum()
    player:drawCards(n, joy__jiezhong.name)
  end,
})

return joy__jiezhong